<?php
/**
 * @file
 * Returns the HTML for a node.
 *
 * Complete documentation for this file is available online.
 * @see https://drupal.org/node/1728164
 */
//dsm($node);

if (!empty($content['field_category'])) {
    print "<div class='header-title'>";

  	//only show the first category
	$categories = $content['field_category']['#items'];
	foreach ($categories as $key => $category) {
	  if (is_numeric($key) && $key > 0) {
		unset($content['field_category']['#items'][$key]);
	  }
	}

    print render($content['field_category']);
    print "</div>";
} else if ($node->type == "html_page") {
    print "<h2" . $title_attributes . "><a href='" . $node_url . "'>" . $node->title . "</a></h2>";
}
?>
<article class="node-<?php print $node->nid; ?> <?php print $classes; ?>"<?php print $attributes; ?>>

  <?php
    // We hide the comments and links now so that we can render them later.
    hide($content['comments']);
    hide($content['field_category']);
    hide($content['links']);
    print render($content);
    print render($content['comments']);
  ?>


</article>
